<?php

if (isset($_POST['r']))
{
	join(@$_POST['i1'], @$_POST['i2'], @$_POST['i3'], @$_POST['i4']);
}

function join($name, $email, $password, $repassword)
{
	include("data.php");
	$sql = "INSERT INTO `$tblusers` VALUES
		(
		NULL,
		'$name',
		'$password',
		'$email',
		'$last',
		'$first',
		'$countryid',
		'$desc',
		'$website',
		'$agreetoterms',
		NOW(),
		CURRENT_TIMESTAMP);";

	$result = mysql_query($sql) or die(mysql_error() );

	$recordid = mysql_insert_id();
	
	include ("bin/_variables.php");
	
	$headers = 'MIME-Version: 1.0' . "\r\n";
	$headers .= 'Content-type: text/plain; charset=iso-8859-1' . "\r\n";

	$headers .= 'From: '.$mailFrom."\r\n";

	$message = '
Greetings '.$username.',

Thank you for opening an account with SoarPort.com!

Your login information is:

Username: '.$username.'
Password: '.$password.'

To change your password, click here: http://www.SoarPort.com/signin.php

-----------------------------------------------------------------------';



	@mail($email, "Your SoarPort.com account information", $message, $headers);

	$url="profile.php?id=$recordid";

	header("Location:signin.php?returnto=$url");
}
$title = "Join";
$content =  <<<EOF
<form action="join.php" method="post">
<table border="1" width="100%">
<tr>
<td style="padding-left:100px">
Register a new account:
<table border="1">
	<tr>
	<td align="right">Name:</td><td><input type="text" name="i1" id="i1" value="{$i1}"/></td></tr>
	<tr>
	<td align="right">Email Address:</td><td><input type="text" name="i2" id="i2" value="{$i2}"/></td></tr>
	<tr>
	<td align="right">Password:</td><td><input type="text" name="i3" id="i3" value="{$i3}"/></td></tr>
	<tr>
	<td align="right">Re-enter Password:</td><td><input type="text" name="i4" id="i4" value="{$i4}"/></td></tr>
	<tr>
	<td align="right">Security Check:</td><td><input type="text" name="i5" id="i5" value="{$i5}"/></td></tr>
	<tr>
	<td></td>
	<td><input type="submit" name="r" value="Register" /></td>
	</tr>
</table>
</td>
<td>
Or sign in using one of these services:
<br />
<img src="social_signin_folio.png" />
</td>
</tr>
</table>
</form>
EOF;

include ("base.php");
echo $html;

?>
